package com.springboot.controller;

import com.springboot.bean.Emp;
import com.springboot.bean.ResultCode;
import com.springboot.service.EmpService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/emp")
public class EmpController {
    @Resource
    private EmpService empService;

    @RequestMapping("/a")
    public String a() {
        return "This is EmpController a";
    }

    @RequestMapping("/b")
    public String[] b() {
        String[] array = {"aa", "bb", "cc"};
        return array;
    }

    @RequestMapping("/c")
    public Emp c(){
        Emp emp=new Emp();
        emp.setEmpNo(11);
        emp.setEname("admin");
        return emp;
    }

    @GetMapping("/find")
        public ResultCode<List<Emp>> find(){
            return empService.findAllEmp();
        }
}
